package com.zys.exercise;

import java.util.ArrayList;
import java.util.Collections;
import java.util.stream.Stream;

public class text1 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("aaa");
        Collections.addAll(list,"bb","cc","dd");
        Stream<String> stream = list.stream();
        stream.forEach((String s)->{
            System.out.print(s+" ");
        });
        System.out.println();
        list.stream().filter((String s)->{
            return s.startsWith("a");
        }).forEach(s -> {
            System.out.println(s);
        });
        list.stream().limit(2).forEach(s->{
            System.out.println(s);
        });
    }
}
